#Copyright 2009-2010 by Ward, David J ( pymethius@ominian.net )
"""
   Freely admit this is SO not a good pattern for use, but I can't think of a better way
   of the top of my head
"""


class _DBFactory(object):
    
    databases = {}
    def getDB(self,DBSourceName):
        if self.databases.has_key(DBSourceName):
            return self.databases[DBSourceName]
            
    def register(self, name, connObj):
        self.databases[name] = connObj
        
    #Another one of those, I will be amazed if it works things
    __call__ = getDB
    
    
DBFactory = _DBFactory()